Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
My Keyboardt
My CSS Keyboard
ESC
1
!
2
"
3
#
4
$
5
%
6
&
7
'
8
(
9
)
0
+
-
£
HOME
DEL
CTRL
Q
W
E
R
T
Y
U
I
O
P
@
*
π
REZ
RUN/STOP
A
S
D
F
G
H
J
K
L
:
[
;
]
=
RETURN
SHIFT LOCK
Z
X
C
V
B
N
M
,
<
.
>
/
?
SHIFT
C=
↑
←
↓
→
F1
F2
F3
F4
F5
F6
F7
F8
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } :root { --c64-brown: #815738; --c64-beige: #d4c5a9; --key-text: #000000; --key-function: #901010; --key-symbol: #2040a0; --transition-speed: 0.3s; } body { margin: 0; padding: 20px; background-color: #404040; display: flex; justify-content: center; align-items: center; min-height: 100vh; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; perspective: 1500px; overflow-x: hidden; } @media (max-width: 1200px) { .keyboard { transform: scale(0.9) rotateX(10deg) rotateY(0deg); } } @media (max-width: 992px) { .keyboard { transform: scale(0.8) rotateX(10deg) rotateY(0deg); } } @media (max-width: 768px) { .keyboard { transform: scale(0.7) rotateX(10deg) rotateY(0deg); } } @media (max-width: 576px) { .keyboard { transform: scale(0.6) rotateX(10deg) rotateY(0deg); } } .keyboard { background-color: var(--c64-brown); border-radius: 10px; padding: 25px 30px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 2px 15px rgba(255, 255, 255, 0.3), inset 0 -8px 20px rgba(0, 0, 0, 0.4); display: grid; grid-template-columns: repeat(17, 42px); grid-gap: 6px; position: relative; border: 3px solid #6b3410; transform: rotateX(10deg) rotateY(0deg); transform-style: preserve-3d; width: fit-content; animation: subtle-float 10s ease-in-out infinite; /* Ajout de l'animation ici */ } .keyboard-title { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); color: var(--c64-beige); font-family: "Arial", sans-serif; font-size: 24px; font-weight: bold; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 10px rgba(0, 0, 0, 0.3); text-transform: uppercase; } .keyboard::after { content: "CODE by HL"; position: absolute; bottom: 25px; left: 25px; color: var(--c64-beige); font-family: "Arial", sans-serif; font-size: 12px; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); } .keyboard::before { content: ""; position: absolute; bottom: -20px; left: 0; right: 0; height: 20px; background-color: #5c2d0c; transform: rotateX(-60deg); transform-origin: top; border-radius: 0 0 10px 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4); } .key { background: linear-gradient(165deg, #f0e6d6, #d4c5a9); border: 2px solid #a89883; border-radius: 4px; height: 38px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--key-text); cursor: pointer; position: relative; transition: all var(--transition-speed); font-size: 11px; box-shadow: 0 5px 8px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.7), inset 0 -3px 4px rgba(0, 0, 0, 0.3); transform-style: preserve-3d; transform: translateZ(4px); } .key::after { content: ""; position: absolute; bottom: -4px; left: 0; right: 0; height: 4px; background-color: #967d63; transform: rotateX(-90deg); transform-origin: top; border-radius: 0 0 3px 3px; } .key:active, .key.pressed { transform: translateZ(0); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.4), inset 0 -1px 2px rgba(0, 0, 0, 0.3); background: linear-gradient(165deg, #d4c5a9, #c4b599); } .key .primary { font-weight: bold; font-size: 13px; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6); } .key .secondary { font-size: 9px; color: var(--key-symbol); margin-top: 2px; } .key.function { color: var(--key-function); background: linear-gradient(165deg, #e6d7bb, #d4c5a9); font-weight: bold; } .key.wide-2 { grid-column: span 2; } .key.space { grid-column: span 11; text-align: center; justify-content: center; transform: translateX(95px); } .commodore { grid-column: span 1; } .key.restore { background: linear-gradient(165deg, #a01818, #801010); color: white; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); box-shadow: 0 5px 8px rgba(0, 0, 0, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.3), inset 0 -3px 4px rgba(0, 0, 0, 0.4); } .side-functions { grid-column: 17; grid-row: 1 / span 4; display: grid; grid-gap: 6px; } .cursor-cross { position: absolute; bottom: 30px; right: 30px; display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(2, 38px); gap: 6px; width: fit-content; } .cursor-cross .key:nth-child(1) { grid-column: 2; grid-row: 1; transform: translateY(-4px); } .cursor-cross .key:nth-child(2) { grid-column: 1; grid-row: 2; } .cursor-cross .key:nth-child(3) { grid-column: 2; grid-row: 2; } .cursor-cross .key:nth-child(4) { grid-column: 3; grid-row: 2; } @keyframes subtle-float { 0%, 100% { transform: rotateX(10deg) rotateY(0deg); } 25% { transform: rotateX(12deg) rotateY(1deg); } 75% { transform: rotateX(8deg) rotateY(-1deg); } }
console.log("Event Fired") document.querySelectorAll(".key").forEach((key) => { key.addEventListener( "mousedown", () => { key.classList.add("pressed"); }, { passive: true } ); key.addEventListener( "mouseup", () => { key.classList.remove("pressed"); }, { passive: true } ); key.addEventListener( "mouseleave", () => { key.classList.remove("pressed"); }, { passive: true } ); }); const keyMap = { Escape: "ESC", F1: "F1", F2: "F2", F3: "F3", F4: "F4", F5: "F5", F6: "F6", F7: "F7", F8: "F8", Backspace: "DEL", Tab: "CTRL", CapsLock: "SHIFT LOCK", Enter: "RETURN", ShiftLeft: "SHIFT", ShiftRight: "SHIFT", Space: "", Home: "HOME", Control: "CTRL", ArrowLeft: "←", ArrowRight: "→", ArrowUp: "↑", ArrowDown: "↓", Digit1: "1", Digit2: "2", Digit3: "3", Digit4: "4", Digit5: "5", Digit6: "6", Digit7: "7", Digit8: "8", Digit9: "9", Digit0: "0", Minus: "-", Equal: "=", KeyQ: "Q", KeyW: "W", KeyE: "E", KeyR: "R", KeyT: "T", KeyY: "Y", KeyU: "U", KeyI: "I", KeyO: "O", KeyP: "P", KeyA: "A", KeyS: "S", KeyD: "D", KeyF: "F", KeyG: "G", KeyH: "H", KeyJ: "J", KeyK: "K", KeyL: "L", KeyZ: "Z", KeyX: "X", KeyC: "C", KeyV: "V", KeyB: "B", KeyN: "N", KeyM: "M", Semicolon: ";", Quote: "@", Comma: ",", Period: ".", Slash: "/", BracketLeft: "[", BracketRight: "]" }; function findKeyElement(code) { if (code === "Space") { return document.querySelector(".key.space"); } let keyToFind = keyMap[code]; if (!keyToFind && code.startsWith("Key")) { keyToFind = code.slice(-1); } if (!keyToFind) return null; const element = Array.from(document.querySelectorAll(".key")).find((el) => { const primaryText = el.querySelector(".primary")?.textContent || ""; const fullText = el.textContent.trim(); return primaryText === keyToFind || fullText === keyToFind; }); return element; } document.addEventListener("keydown", (e) => { e.preventDefault(); const keyElement = findKeyElement(e.code); if (keyElement) { keyElement.classList.add("pressed"); } }); document.addEventListener("keyup", (e) => { e.preventDefault(); const keyElement = findKeyElement(e.code); if (keyElement) { keyElement.classList.remove("pressed"); } }); let ticking = false; document.addEventListener( "mousemove", (e) => { if (!ticking) { window.requestAnimationFrame(() => { const keyboard = document.querySelector(".keyboard"); const rect = keyboard.getBoundingClientRect(); const centerX = rect.left + rect.width / 2; const centerY = rect.top + rect.height / 2; const rotateY = (e.clientX - centerX) * 0.015; const rotateX = (e.clientY - centerY) * -0.015; keyboard.style.transform = `rotateX(${ 10 + rotateX }deg) rotateY(${rotateY}deg)`; ticking = false; }); ticking = true; } }, { passive: true } );